package com.fanketly.funacg2.data.model


import com.google.gson.annotations.SerializedName
import com.lzx.starrysky.SongInfo

fun SongInfo.convertToWork() =
    WorkList.Work(id = artist.toInt(), img240 = songCover, title = songName)


@kotlinx.serialization.Serializable
data class WorkList(
    @SerializedName("pagination")
    val pagination: Pagination = Pagination(),
    @SerializedName("data")
    val works: List<Work> = listOf(),
) {
    @kotlinx.serialization.Serializable
    data class Pagination(
        @SerializedName("currentPage")
        val currentPage: Int = 0,
        @SerializedName("pageSize")
        val pageSize: Int = 0,
        @SerializedName("totalCount")
        val totalCount: Int = 0,
    )

    @kotlinx.serialization.Serializable
    data class Work(
        @SerializedName("id")
        val id: Int = 0,
        @SerializedName("img")
        val img: String = "",
        @SerializedName("name")
        val name: String = "",
        @SerializedName("rateAverage")
        val rateAverage: Float = 0f,
        @SerializedName("rateCount")
        val rateCount: Int = 0,
        @SerializedName("tags")
        val tags: List<Tag> = listOf(),
        @SerializedName("img240")
        val img240: String = "",
        @SerializedName("title")
        val title: String = "",
        val createDate: String = "",
        @SerializedName("cv")
//        val cv: List<CV> = listOf(),
        val cv: String = "",
    ) {


        @kotlinx.serialization.Serializable
        data class Tag(
            @SerializedName("id")
            val id: Int = 0,
            @SerializedName("name")
            val name: String = "",
        )
//        @kotlinx.serialization.Serializable
//        data class CV(
//            @SerializedName("id")
//            val id: String = "",
//            @SerializedName("name")
//            val name: String = "",
//        )

        override fun toString(): String {
            return "Work(id=$id, img='$img', name='$name', rateAverage=$rateAverage, rateCount=$rateCount, tags=$tags, img240='$img240', title='$title', cv='$cv')"
        }


    }
}